home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11441 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: ix.netcom.com!netnews
  2. From: jlilley@ix.netcom.com (John Lilley)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Class of incomplete type - HELP
  5. Date: 14 Mar 1996 16:58:12 GMT
  6. Organization: Netcom
  7. Message-ID: <4i9j74$2m1@cloner3.netcom.com>
  8. References: <4hvgp9$8jr@crocus.csv.warwick.ac.uk>
  9. NNTP-Posting-Host: den-co7-20.ix.netcom.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-NETCOM-Date: Thu Mar 14  8:58:12 AM PST 1996
  13. X-Newsreader: WinVN 0.99.7
  14.  
  15. In article <4hvgp9$8jr@crocus.csv.warwick.ac.uk>, esuqf@csv.warwick.ac.uk 
  16. says...
  17. >I've got a problem for an assignment ...
  18. >
  19. >class List {
  20. >}
  21. >
  22. >class alphabet {
  23. >public:
  24. >char plain (char cipherin) {}
  25. >}
  26. >
  27. >class Blackboard {
  28. >public:
  29. >   Boolean isSolved() {
  30. >        char cipherletter = current->letter // Character node of linked list
  31. >        if ( plain(cipherletter) == '*' )
  32. >                return False;
  33. >   }
  34. >}
  35. >
  36. >
  37. >1. I compile using: g++ list.C alphabet.C blackboard.C
  38. >
  39. >   Error message:
  40. >   blackboard.C: In method `enum Boolean Blackboard::isSolved()':
  41. >   blackboard.C:70: warning: implicit declaration of function `int 
  42. plain(...)'
  43.  
  44. plain() is a member of class alphabet and must be called through
  45. an object of type alphabet.  It is not a function.  The compiler
  46. assumed that you were trying to call an undeclared function, which
  47. it defulta to a return type of 'int'.
  48.  
  49. >2. I tried to inherit the alphabet class in the Blackboard class, 
  50. >   thinking that the code would work if char plain(..) becomes a 
  51. >   member function of Blackboard, I get the following:
  52. >
  53. >   class Blackboard: public alphabet {
  54. >   ..............
  55. >   }
  56. >   blackboard.H:4: base class `alphabet' has incomplete type
  57. >   What does incomplete type mean?
  58.  
  59. It means that the class declaration for alphabet has not been completed.
  60. This is typically found when you type:
  61.     class alphabet;
  62.     class Blackboard : public alphabet {};
  63. Since you are not doing that, I would get out the (apparently)
  64. missing semicolons that must follow the closing brace of the
  65. class declaration, which may be confusing the compiler into thinking
  66. that the first class declaration has not been completed.
  67.  
  68. john lilley
  69.  
  70.